//轮播图
var swiper = new Swiper('.evaluate .swiper-container', {
	spaceBetween: 0,
	centeredSlides: true,
	autoplay: {
		delay: 25000,
		disableOnInteraction: false,
	},
	pagination: {
		el: '.swiper-pagination',
		clickable: true,
	},
	navigation: {
		nextEl: '.swiper-button-next',
		prevEl: '.swiper-button-prev',
	},
	loop: true
});


// 选项卡
var list = document.querySelectorAll(".list li")
console.log(list)
var lists = document.querySelectorAll(".list_s ul")
console.log(lists)
for(var i = 0; i < list.length; i++) {
	list[i].index = i;
	list[i].addEventListener('click', function() {
		for(var k = 0; k < list.length; k++) {
			list[k].classList.remove('active')
			lists[k].classList.remove('active')
		}
		this.classList.add('active');
		console.log(this.index)
		lists[this.index].classList.add('active')
	})
}

//兼容性
var t = document.querySelector(".navbar")

var nav = document.querySelectorAll(".navbar-nav > li");

var pop = document.querySelector("#toTop");

window.onscroll = function() {
	console.log(document.documentElement.scrollTop > 60 || document.body.scrollTop > 60);
	var height = document.documentElement.scrollTop || document.body.scrollTop;
	console.log(height);
	if(height >= 60) {
		t.style.background = "#000";

	} else {
		t.style.background = "#0000";
	}

	if(height >= 600) {
		pop.style.display = "block";
	} else {
		pop.style.display = "none";
	}

	//点击返回顶部
	pop.addEventListener('click', function() {
		// window.scrollTo(0,0);
		window.scrollTo({
			top: 0,
			behavior: 'smooth'
		})

	});

	for(var h = 0; h < nav.length; h++) {
		nav[h].style.background = '';
		if(height >= 600 && height < 1100) {
			nav[0].style.backgroundColor = ' rgba(255, 255, 255, 0.2)';
		} else if(height >= 1100 && height < 2100) {
			nav[1].style.backgroundColor = ' rgba(255, 255, 255, 0.2)';
		} else if(height >= 2100 && height < 2800) {
			nav[2].style.backgroundColor = ' rgba(255, 255, 255, 0.2)';
		} else if(height >= 2800 && height < 3200) {
			nav[3].style.backgroundColor = ' rgba(255, 255, 255, 0.2)';
		} else if(height >= 3200) {
			nav[4].style.backgroundColor = ' rgba(255, 255, 255, 0.2)';
		}
	}

	nav[0].addEventListener('click', function() {
		nav[0].style.backgroundColor = ' rgba(255, 255, 255, 0.2)';
		window.scrollTo({
			top: 600,
			//平滑滚动
			behavior: 'smooth'
		})
	})

	nav[1].addEventListener('click', function() {
		nav[1].style.backgroundColor = ' rgba(255, 255, 255, 0.2)';
		window.scrollTo({
			top: 1100,
			behavior: 'smooth'
		})
	})

	nav[2].addEventListener('click', function() {
		nav[2].style.backgroundColor = ' rgba(255, 255, 255, 0.2)';
		window.scrollTo({
			top: 2100,
			behavior: 'smooth'
		})
	})

	nav[3].addEventListener('click', function() {
		nav[3].style.backgroundColor = ' rgba(255, 255, 255, 0.2)';
		window.scrollTo({
			top: 2800,
			behavior: 'smooth'
		})
	})

	nav[4].addEventListener('click', function() {
		nav[4].style.backgroundColor = ' rgba(255, 255, 255, 0.2)';
		window.scrollTo({
			top: 3200,
			behavior: 'smooth'
		})
	})

}